import os
import threading


# 启动 Flask 应用程序
def run_flask_app():
    os.system("python api.py")

# 启动 b.py
def run_chat_api():
    os.system("python chatapi.py")

if __name__ == "__main__":
    # 创建两个线程分别运行 Flask 应用程序和 b.py
    flask_thread = threading.Thread(target=run_flask_app)
    b_py_thread = threading.Thread(target=run_chat_api)

    # 启动线程
    flask_thread.start()
    b_py_thread.start()

    # 等待线程结束
    flask_thread.join()
    b_py_thread.join()
